package yg.engine;

import android.opengl.GLSurfaceView;
import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL;
import javax.microedition.khronos.opengles.GL10;

public class YGRenderer implements GLSurfaceView.Renderer
{

	public YGRenderer()
	{
		
	}

	public void onSurfaceChanged(GL10 gl, int w, int h)
	{
		System.out.println("YGRenderer: onSurfaceChanged");
		
		NativeResize(w, h);
	}

	public void onSurfaceCreated(GL10 gl, EGLConfig config)
	{	
		System.out.println("YGRenderer: onSurfaceCreated");
		
		NativeInit();
	}
	
	public void surfaceDestroyed() 
	{
		System.out.println("YGRenderer: surfaceDestroyed");
	}

	public void onDrawFrame(GL10 gl) 
	{
		NativeRender();
    	}
	
	/*
		Native functions
	*/
	
	public native void NativeInit();
	public native void NativeResize(int a_Width, int a_Height);
	public native void NativeRender();

}